const koaBody = require('koa-body')({multipart: true, uploadDir: '.'});
const  Router = require('koa-router'),
    router = new Router(),
    User = require('../controllers/UserController.js'),
    // AdminUser = require('../controllers/AdminUserController.js'),
    // AnswerLog = require('../controllers/AdminUserController.js'),
    TeachMaterial = require('../controllers/TeachMaterialController.js'),
    LearningContent = require('../controllers/LearningContentController.js'),
    Question = require('../controllers/QuestionController.js');

router
    .get('/', User.homePage)                     
    .get('/register', User.registerPage)                     
    .post('/register', koaBody, User.register)                     
    .get('/login', User.loginPage)                     
    .post('/login', User.login)                     
    .get('/logout', User.logout)                     
    // .get('/user/:id', User.index)                                      
    // .get('/user/:id/answerlog', AnswerLog.listAll)                     
    // .get('/user/:id/answerlog/:id', AnswerLog.getOne)                     
    // .get('/admin:id', AdminUser.index)                                        
    .get('/teachmaterial', TeachMaterial.index)                        
    .get('/teachmaterial/:id', TeachMaterial.detail)                        
    // .get('/learningcontent', LearningContent.listAll)                        
    .get('/learningcontent/:id', LearningContent.detail)                    
    // .get('/question/onePage', Question.onePage)                    
    .get('/question/onePage/:teachmaterialid', Question.onePageDetail)                    
    .post('/question/calculateScore', Question.calculateScore)                    
    
exports = module.exports = router;


